<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\helpers\Constants;

/* @var $this yii\web\View */
/* @var $searchModel common\modules\system\backend\models\search\DataDictionarySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('backend', 'System Dictionary');
$this->params['breadcrumbs'][] = $this->title;
$category = getGetValue('category');
?>
<div class="data-dictionary-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
    <p>
        <?= Html::a('返回', ['/system/data-dictionary-category'], ['class' => 'btn btn-primary'])?>
        <?= Html::a('创建数据字典', [
            'create','category'=>$category
        ], [
            'class' => 'btn btn-success'
        ])?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            [
                'class' => 'common\grid\IdColumn',
            ],            
			[
    			'class' => 'common\grid\DataColumn',
    			'attribute' => 'name',
    			'width' => '50px',
    			'format' => 'html',
    			'value' => function ($model,$key,$index,$column){
    			    return str_repeat(Constants::TAB_SIZE, $model->level).Html::a($model->name,['/system/data-dictionary/update','id'=>$model->id]);
    			}
			],
            [
                'class' => 'common\grid\DataColumn',
                'attribute' => 'value',
                'format' => 'ntext',
            ],            
            
            // 'description',
            // 'thumbnail',
            [
              'class' => 'common\grid\SortColumn',
            ],
            [
              'class' => 'common\grid\StatusColumn',
            ],
            [
                'class' => 'common\grid\ActionColumn',
				'queryParams' => ['view' => ['category' => $category]]
			],

        ],
    ]);
    ?>

</div>
